//
//  ConstAndMacros.h
//  JingMing
//
//  Created by JetHunag on 15/7/22.
//  Copyright (c) 2015年 ____JD____. All rights reserved.
//

#ifndef JingMing_ConstAndMacros_h
#define JingMing_ConstAndMacros_h
//全局pre pv名
static NSString * prePVName;
static double  prePVTimeStamp;

/**************************** 常用缩写定义 （开始）*****************************/
#define SharedApp [JMAppdelegateManager sharedJMAppdelegateManager]
#define IOS_VERSION                                     [UIDevice currentDevice].systemVersion.floatValue
#define kScreenHeight                                   [[UIScreen mainScreen] bounds].size.height
#define kScreenWidth                                    [[UIScreen mainScreen] bounds].size.width
#define kDynamicWidth(d)                                ((kScreenWidth/375)*d)
#define kDynamicHeight(d)                               ((kScreenHeight/667)*d)
#define JMUnprocessTime                                 (5*60)
#define JMUnAcceptTime                                  (1*60)
#define JMDeliveryExceptionTime                         (15*60)
#define JMAfterSaleWaitAuthTime                         (30*60)
#define JMApplayCancelTime                              (1*60)
#define kIsEarlierIphone4S                             ([[UIScreen mainScreen] bounds].size.height <= 480.0f ? YES:NO)
#define kIsEarlierIphone5S                             ([[UIScreen mainScreen] bounds].size.height <= 568.0f ? YES:NO)
#define kIsIphone5S                                     ([[UIScreen mainScreen] bounds].size.height == 568.0f ? YES:NO)
#define IS_IPHONE6                                      ([[UIScreen mainScreen] bounds].size.height == 667.0f ? YES:NO)
#define IS_BiggerThanIPHONE6                                      ([[UIScreen mainScreen] bounds].size.height >= 667.0f ? YES:NO)
#define kIsIphone6Plus                                  ([[UIScreen mainScreen] bounds].size.height == 736.0f ? YES:NO)
#define IS_IPHONEX                                      ([[UIScreen mainScreen] bounds].size.height >= 812.0f ? YES:NO)
#define kStatusBarHeight                                ([[UIApplication sharedApplication]  statusBarFrame].size.height)
//#define kStatusBarHeight \
// (^{\
//    double statusBarHeight = 0;\
//    if (@available(iOS 13.0, *)) {\
//        UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager;\
//        statusBarHeight = statusBarManager.statusBarFrame.size.height;\
//    }\
//    else {\
//        statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;\
//    }\
//    return statusBarHeight;\
//}())\

#define kNavigationBarHeight                            (44 + kStatusBarHeight)
#define kTabBarHeight                                   (IS_IPHONEX ? 83 : 49)
#define WeakSelf(self)                                  __weak typeof (self) weakSelf = self
#define StrongSelf(strongSelf)                          __strong typeof (&*weakSelf) strongSelf = weakSelf

#define WEAKSELF __weak __typeof(&*self)weakSelf = self;
#define STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf;


#define NSStringWithFormat(...)                         [NSString stringWithFormat:__VA_ARGS__]

#define RGBColor(R,G,B)                                 [UIColor colorWithRed:(R)/255.0 green:(G)/255.0 blue:(B)/255.0 alpha:1.0]

#define RGBAColor(R,G,B,A)                              [UIColor colorWithRed:(R)/255.0 green:(G)/255.0 blue:(B)/255.0 alpha:A]

#define ImageNamed(_pointer)                            [UIImage imageNamed:_pointer]

#define KeyboardHidden               [[[UIApplication sharedApplication] keyWindow] endEditing:YES]



#define SYSTEM_VERSION ([[UIDevice currentDevice] systemVersion])
#define IOS9_OR_LATER (SYSTEM_VERSION.floatValue >= 9.0)
#define JMPFMFont(d) IOS9_OR_LATER ? [UIFont fontWithName:@"PingFangSC-Medium" size:d]:[UIFont systemFontOfSize:d]
#define JMPFRFont(d) IOS9_OR_LATER ? [UIFont fontWithName:@"PingFangSC-Regular" size:d]:[UIFont systemFontOfSize:d]

#define kStoreListPath                                  @"store_list"

#define JDGateWayDataError                              @"网络异常，请检查后重试！"

#define JM_Assert(condition) NSAssert(condition, ([NSString stringWithFormat:@"JD Assert: [FILE] = %s \n\t [FUNCTION] = %s \n\t [LINE]: %d", __FILE__, __FUNCTION__, __LINE__]));
#define JMTextPermission  @"您的账号角色没有此权限，请到商家中心更换更高权限的角色"
#define JMShowPermissionAlert  UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:JMTextPermission delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];\
[alert show];\

#define JMToastAllStationInViewController(vc)  [vc showAlertMessage:@"全门店状态下不可用"]
#define JMPermissionForKey(key) [[JMPermissionCenter sharedJMPermissionCenter] permissionForKey:key]
#define JMIsAllStationState  [JDAccountManager sharedJDAccountManager].isAllStation
#define JMAllStationErrorMsg      @"全门店状态下不可用"
/**************************** 常用缩写定义 （结束）*****************************/

//@"672b1d54694741211a5ac33d"
/**************************** 极光相关定义 （开始）*****************************/
#define kJPushAppKey            @"e99a85757ecd88afbb2fbb39"
#define kJPushChannel              @"appstore"
/**************************** 极光相关定义 （结束）*****************************/

/**************************** 友盟相关定义 （开始）*****************************/
#define kUMChannel              @"App Store"
/**************************** 友盟相关定义 （结束）*****************************/


/**************************** UserDefaultKey定义 （开始）*****************************/
#define JMApnsTokenUserDefaultKey                   @"JMManagerAPNSTokenKey"
#define JMDisclaimerUserDefaultKey                  @"JMDisclaimerUserDefaultKey"
#define JMShowsMaterialFlowUserDefaultKey           @"JMShowsMaterialFlowUserDefaultKey"

#define JMShowsRefreshTipUserDefaultKey             @"UDHasShowRefreshTip"

#define JMShowsCaptureTipUserDefaultKey             @"CaptureHasShowTipView"

#define JMShowsMakeMoneyTipUserDefaultKey           @"ShowsMakeMoneyTipUserDefaultKey"
#define JMIsDefaultPasswordUserDefaultKey           @"IsDefaultPasswordUserDefaultKey"
#define JMChangeAutoPrintStatusFinish               @"JMChangeAutoPrintStatusFinish"

/**************************** UserDefaultKey定义 （结束）*****************************/

/**************************** 通知定义 （开始）*****************************/
#pragma mark - notification

#define JMNet302Notification                    @"JMNet302Notification"
#define JMNet301Notification                    @"JMNet301Notification"
#define JMNet200Notification                    @"JMNet200Notification"
#define JMNetEnterInitNotification              @"JMNetEnterInitNotification"
#define JMEnterPrinterSetterKey                 @"JMEnterPrinterSetterKey"



#endif

